<template>
<view>
	<view class="header">
		<video id="myVideo" :src="imgUrl+videoUrl"
		        enable-danmu danmu-btn controls>
		</video>
	</view>
	
	<view class="type-ad-container">
		<view @click="jump(item)" class="type-ad-navbar-item" v-for="(item,index) in video" :key="index">
			<view>
				<image :src="imgUrl+item.img" :class="{borderRed : item.video == videoUrl}"></image>
			</view>
			<view class="job">
				<text>{{item.name}}</text>
				<text v-if="item.video == videoUrl" class="colorRed">播放中...</text>
			</view>
		</view>
	</view>
	
</view>		
</template>

<script>
import request from '@/util/request.js'
export default {
	data() {
		return {
			imgUrl:this.url,
			video:[],
			videoUrl:''
		}
	},
	onLoad(){
		uni.showLoading({  
		    title: '加载中'  
		});
		this.getVideo()
	},
	methods: {
		getVideo(){
			var that = this;
			request({
				url: 'explain/list',
				method: 'get',
				success: (res) => {
					uni.hideLoading();
					that.video = res.data.data
					that.videoUrl = res.data.data[0]['video']
				}
			})
		},
		jump(item){
			this.videoUrl = item.video
		}
	}
}
</script>

<style>
	@import url("./index.css");
</style>
